#include <stdio.h>

main()
{
    int i, num_flds, idx;
    char line[100], fld1[100], fld2[100], fld3[100];
    char cmd[8], id[50][100], name[50][100], addr[50][100];

    idx = 0;
    while (gets(line) != NULL)
    {
	num_flds = sscanf(line,"%s %s %s %s",cmd,fld1,fld2,fld3);
	printf("cmd=%s\n",cmd);
	if (num_flds == 4)
	{
	    strcpy(id[idx],fld1);
	    strcpy(name[idx],fld2);
	    strcpy(addr[idx],fld3);
	    idx++;
	}
	else
	{
	    for (i=0; i < idx; i++)
		if (strcmp(fld1,"id") == 0)
		    printf("%s\n",id[i]);
		else if (strcmp(fld1,"all") == 0)
		    printf("%s %s %s\n",id[i],name[i],addr[i]);
	}
    }
}
